<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: paul
  Date: 2017-09-03
  Time: 21:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyUI/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyUI/themes/icon.css">
    <script src="${pageContext.request.contextPath}/easyUI/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/easyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyUI/jquery.edatagrid.js"></script>
    <script charset="gb2312"  src="${pageContext.request.contextPath}/js/crud.js"></script>
    <script src="${pageContext.request.contextPath}/easyUI/src/jquery.form.js"></script>
    <title>Title</title>
</head>
<body>
<h2>商品列表</h2>
<div class="demo-info" style="margin-bottom:10px">
    <div class="demo-tip icon-tip">&nbsp;</div>
    <div>Enter search values and press search button.</div>
</div>

<table id="dg" class="easyui-datagrid" style="width:100%;height:500px"
       url="${pageContext.request.contextPath }/item/getItems"
       title="列表" toolbar="#tb,#toolbar"
       rownumbers="true" pagination="true">
    <thead>
    <tr>
        <th field="name" width="200" editor="{type:'validatebox',options:{required:true}}">商品名称</th>
        <th field="price" width="200" editor="{type:'validatebox',options:{required:true}}">价格</th>
        <th field="pic" width="200" editor="text">图片</th>
        <th field="createtime" width="200" editor="{type:'validatebox',options:{validType:'email'}}">生产日期</th>
        <th field="detail" width="200" editor="{type:'validatebox',options:{validType:'email'}}">商品简介</th>
    </tr>
    </thead>
</table>

<div id="toolbar">
    <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newItem()">添加商品</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editItem()">修改商品</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyItem()">删除商品</a>
</div>

<div id="tb" style="padding:3px">
    <span>产品名称:</span>
    <input id="name" style="line-height:26px;border:1px solid #ccc">
    <a href="#" class="easyui-linkbutton" plain="true" onclick="doSearch()">Search</a>
</div>

<%--添加用户的表单--%>
<div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
     closed="true" buttons="#dlg-buttons">
    <div class="ftitle">添加商品</div>
    <form id="fm" enctype="multipart/form-data" method="post">
        <div class="fitem">
            <label>商品名称:</label>
            <input name="name" class="easyui-validatebox" required="true">
        </div>
        <div class="fitem">
            <label>价格:</label>
            <input name="price" class="easyui-validatebox" value="1000" required="true">
        </div>
        <div class="fitem">
            <label>图片</label>
            <input name="pic" type="file">
        </div>
        <div class="fitem">
            <label>生产日期</label>
            <input  name="createtime" class="easyui-datebox" required="true">
        </div>
        <div class="fitem">
            <label>详情描述</label>
            <textarea name="detail" class="easyui-validatebox"></textarea>
        </div>
    </form>
</div>
<div id="dlg-buttons">
    <a href="#"
       class="easyui-linkbutton" iconCls="icon-ok" onclick="saveItem()">保存</a>
    <a href="#" class="easyui-linkbutton" iconCls="icon-cancel"
       onclick="javascript:$('#dlg').dialog('close')">Cancel</a>
</div>
</body>
</html>
